foreach(VERSION 120 200 210 220 300)
    set(TEST_EXE test_extension_loader_cpp_${VERSION})
    add_executable(${TEST_EXE} test_extension_loader.cpp)
    set_target_properties(${TEST_EXE} PROPERTIES FOLDER "OpenCLExtensionLoader/Tests")
    target_include_directories(${TEST_EXE} PUBLIC ${OPENCL_EXTENSION_LOADER_INCLUDE_DIRS})
    target_compile_definitions(${TEST_EXE} PUBLIC -DCL_TARGET_OPENCL_VERSION=${VERSION})
    if (OPENCL_EXTENSION_LOADER_INCLUDE_GL)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_GL)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_EGL)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_EGL)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_DX9)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_DX9)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_D3D10)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_D3D10)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_D3D11)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_D3D11)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_VA_API)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_VA_API)
    endif()
    target_link_libraries(${TEST_EXE} PUBLIC ${OPENCL_EXTENSION_LOADER_LIBRARIES} OpenCLExt)
    add_test(NAME ${TEST_EXE} COMMAND ${TEST_EXE})
endforeach(VERSION)

foreach(VERSION 120 200 210 220 300)
    set(TEST_EXE test_extension_loader_c_${VERSION})
    add_executable(${TEST_EXE} test_extension_loader.c)
    set_target_properties(${TEST_EXE} PROPERTIES FOLDER "OpenCLExtensionLoader/Tests")
    target_include_directories(${TEST_EXE} PUBLIC ${OPENCL_EXTENSION_LOADER_INCLUDE_DIRS})
    target_compile_definitions(${TEST_EXE} PUBLIC -DCL_TARGET_OPENCL_VERSION=${VERSION})
    if (OPENCL_EXTENSION_LOADER_INCLUDE_GL)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_GL)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_EGL)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_EGL)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_DX9)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_DX9)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_D3D10)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_D3D10)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_D3D11)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_D3D11)
    endif()
    if (OPENCL_EXTENSION_LOADER_INCLUDE_VA_API)
        target_compile_definitions(${TEST_EXE} PRIVATE CLEXT_INCLUDE_VA_API)
    endif()
    target_link_libraries(${TEST_EXE} PUBLIC ${OPENCL_EXTENSION_LOADER_LIBRARIES} OpenCLExt)
    add_test(NAME ${TEST_EXE} COMMAND ${TEST_EXE})
endforeach(VERSION)

